
package me.zhengjie.modules.workOrder.domain;
import me.zhengjie.base.BaseEntity;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author 李奎
* @date 2023-06-29
**/
@Entity
@Data
@SuppressWarnings("all")
@Table(name="wk_work_order_detail")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class WorkOrderDetail extends BaseEntity implements Serializable {
    @Id
    @Column(name = "`work_detail_id`",length = 32)
    @ApiModelProperty(value = "工单明细主键id")
    @GeneratedValue(generator = "jpa-uuid")
    private String workDetailId;


    @Column(name = "`work_head_id`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "工单头id")
    private String workHeadId;

    @Transient //字段忽略
    @Column( updatable= false, insertable = false) // 修改和插入排除
    @ApiModelProperty(value = "所属项目名称")
    private String projectName;

    @Column(name = "`create_by`")
    @ApiModelProperty(value = "创建者")
    private String createBy;

    @Column(name = "`update_by`")
    @ApiModelProperty(value = "更新者")
    private String updateBy;

    @Column(name = "`create_time`")
    @ApiModelProperty(value = "创建日期")
    private Timestamp createTime;

    @Column(name = "`update_time`")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "`work_status`",nullable = false)
    @ApiModelProperty(value = "工单状态")
    private String workStatus;

    @Column(name = "`question_description`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "工单描述")
    private String questionDescription;

    @Column(name = "`question_solution`")
    @ApiModelProperty(value = "解决办法")
    private String questionSolution;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "`is_delete`")
    @ApiModelProperty(value = "删除标识（0：删除，1：未删除）")
    private String isDelete;

    @Column(name = "`order_number`")
    @ApiModelProperty(value = "排序")
    private Integer orderNumber;

    @Column(name = "`start_user`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "提问人")
    private String startUser;

    @Column(name = "`end_user`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "处理人")
    private String endUser;

    @Column(name = "`end_time`")
    @ApiModelProperty(value = "处理时间")
    private Timestamp endTime;

    @Column(name = "`start_time`")
    @ApiModelProperty(value = "提问时间")
    private Timestamp startTime;

    @Column(name = "`work_hours`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "工时(人/天)")
    private BigDecimal workHours;

    @Column(name = "`question_type`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "类型(1-系统bug; 2-常规运维; 3-系统优化; 4-新增需求;)")
    private String questionType;

    @Column(name = "`enterprise_code`")
    @ApiModelProperty(value = "所属机构")
    private String enterpriseCode;

    public void copy(WorkOrderDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
